
<script>
	function playCenterSearch() {
		setGridSearchParams('playCenterMember_list','playCenterSearchForm',false,reloadPlayCenterMember);
	}
	
	function clearPlayCenterSearch() {
		setGridSearchParams('playCenterMember_list','playCenterSearchForm',true,reloadPlayCenterMember);
	}
	
	//表格查询  
	function reloadPlayCenterMember() {
		var params = playCenterMember_list.datagrid('options').queryParams; //先取得 datagrid 的查询参数  
		printLog(params);
		playCenterMember_list.datagrid('reload'); //设置好查询参数 reload 一下就可以了  
		playCenterMember_list.datagrid('unselectAll');
		playCenterMember_list.datagrid('uncheckAll');
	}
	
	function startGameCenter() {
		var rows = playCenterMember_list.datagrid('getChecked');
		if (rows&&rows.length>0) {
			if(rows.length>1) {
				showMsg('请选择一条操作记录.');
				return;
			}
			if(rows[0].account<3000) {
				showMsg('金额少于3000，无法开庄.');
				return;
			}
			
// 			$.messager.confirm('询问','你确认要开庄吗?',function(r){
// 	        	if (r){
	        		createFromWindow("开庄信息", "playCenter.do?skip&page=editPlayInfo&memberId=" + rows[0].id,
	    					"playCenter.do?saveStartInfo", function(data) {
	    						reloadPlayCenterMember();
	    					},true,550,320);
// 	            }
// 	        });
		} else {
			showMsg('请选择操作记录.');
		}
	}
	
	function onClickPlayCenter(rowIndex, rowData) {
		//先取得 datagrid 的查询参数  
		var params = $('#playStart_list').datagrid('options').queryParams;
		params['memberId'] = rowData.id;
		//设置好查询参数 reload 一下就可以了 
		$('#playStart_list').datagrid('reload');  
	}
	////////////////////////////////////
	function playStartSearch() {
		setGridSearchParams('playStart_list','playStartSearchForm',false,reloadStartPlayCenterMember);
	}
	
	function clearPlayStartSearch() {
		setGridSearchParams('playStart_list','playStartSearchForm',true,reloadStartPlayCenterMember);
	}
	
	//表格查询  
	function reloadStartPlayCenterMember() {
		var params = playStart_list.datagrid('options').queryParams; //先取得 datagrid 的查询参数  
		playStart_list.datagrid('reload'); //设置好查询参数 reload 一下就可以了  
		playStart_list.datagrid('unselectAll');
		playStart_list.datagrid('uncheckAll');
	}
	
	//开局游戏
	function playStartGame() {
		var rows = playStart_list.datagrid('getChecked');
		printLog(rows);
		if (rows&&rows.length>0) {
			if(rows.length>1) {
				showMsg('请选择一条操作记录.');
				return;
			}
			createFromWindowOptions({
				title:"开局信息",
				maximizable:true,
				href:"playStart.do?playStartGame&playStartId=" + rows[0].id,
				callback:function(data) {
					savePlayGameStart();
				},
				enableSaveButton:true
			});
			
// 			createFromWindow("开局信息", "playStart.do?playStartGame&playStartId=" + rows[0].id,
// 					"playStart.do?savePlayStart", function(data) {
// 						savePlayGameStart();
// 					},true);
		} else {
			showMsg('请选择操作记录.');
		}
	}
</script>
<div class="easyui-layout" data-options="fit:true">
	<div data-options="region: 'west', title: '玩家账号',border:false, split: true," style="width: 380px;">
		<@eu.datagrid id="playCenterMember_list" toolbar="#playCenterlist_search" idField="id" pagination="false"
			 url="playMember.do?loadList" rownumbers="true" onClickRow="onClickPlayCenter(rowIndex, rowData)"
			 item="com.xdtech.play.vo.PlayMemberItem"/>
		
		<div id="playCenterlist_search">
			<div style="margin-bottom:5px;padding-left:5px;margin-top: 5px;">
				<form id="playCenterSearchForm">
					<table>
						<tr>
							<td>玩家名称：</td>
							<td><input class="easyui-validatebox textbox" name="name" /></td>
							<td colspan="2">
								<@eu.linkbutton showName="查询" iconCls="icon-search" onclick="playCenterSearch()"/>
	 					 		<@eu.linkbutton showName="清空" iconCls="icon-clear" onclick="clearPlayCenterSearch()"/>
 					 		</td>
						</tr>
					</table>
				</form>
				
			</div>
			<div id="playCenter_toolbar" style="height: auto">
				<@eu.linkbutton showName="开庄" shiro="sh:playCenter:edit" iconCls="icon-edit" onclick="startGameCenter()"/>
				<@eu.linkbutton showName="刷新" shiro="sh:playCenter:refresh" iconCls="icon-reload" onclick="reloadPlayCenterMember()"/>
				
			</div>
		</div>
	</div>
	<div data-options="region:'center',border:false">
		<@eu.datagrid id="playStart_list" toolbar="#playStartlist_search" idField="id" 
			 url="playStart.do?loadList" rownumbers="true" pagination="false"
			 item="com.xdtech.play.vo.PlayStartItem"/>
		<div id="playStartlist_search">
			<div style="margin-bottom:5px;padding-left:5px;margin-top: 5px;">
				<form id="playStartSearchForm">
					<!-- 防止form表单里只有一个text元素时候，按enter键自动提交问题 -->
					<input style="display:none" />
					<table>
<!-- 						<tr> -->
<!-- 							<td>庄家名称：</td> -->
<!-- 							<td><input class="easyui-validatebox textbox" name="memberName" /></td> -->
<!-- 							<td> -->
<!-- 								<@eu.linkbutton showName="查询" iconCls="icon-search" onclick="playStartSearch()"/> -->
<!-- 	 					 		<@eu.linkbutton showName="清空" iconCls="icon-clear" onclick="clearPlayStartSearch()"/> -->
<!--  					 		</td> -->
<!-- 						</tr> -->
					</table>
				</form>
				
			</div>
			<div id="playStart_toolbar" style="height: auto">
<!-- 				<@eu.linkbutton showName="新增" shiro="play:playStart:add" iconCls="icon-add" onclick="addPlayStart()"/> -->
<!-- 				<@eu.linkbutton showName="删除" shiro="play:playStart:delete" iconCls="icon-remove" onclick="deletePlayStart()"/> -->
<!-- 				<@eu.linkbutton showName="编辑" shiro="play:playStart:edit" iconCls="icon-edit" onclick="editPlayStart()"/> -->
				<@eu.linkbutton showName="开局" shiro="play:playStart:startGame" iconCls="icon-add" onclick="playStartGame()"/>
				<@eu.linkbutton showName="刷新" shiro="play:playStart:refresh" iconCls="icon-reload" onclick="reloadStartPlayCenterMember()"/>
				
			</div>
		</div>
	</div>
</div>